#define _CRT_SECURE_NO_WARNINGS 1
int* resultArray(int* nums, int numsSize, int* returnSize) {
    int a[50];
    int b[50];
    a[0] = nums[0];
    b[0] = nums[1];
    int k = 0, m = 0;
    for (int i = 2; i < numsSize; i++)
    {
        if (a[k] > b[m])
            a[++k] = nums[i];
        else
            b[++m] = nums[i];
    }

    int* result = (int*)malloc(numsSize * sizeof(int));
    for (int i = 0; i <= k; i++)
    {
        result[i] = a[i];
    }
    for (int i = 0; i <= m; i++)
    {
        result[k + i + 1] = b[i];
    }
    *returnSize = numsSize;
    return result;
}